package com.orangelife.mobile.activities.adapter;

import java.util.List;
import java.util.Map;

import com.curry.orangelife.mobile.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class ActivityDetailListViewAdapter extends BaseAdapter {

	private Context context;
	private List<Map<String,Object>> list;
	
	public ActivityDetailListViewAdapter(Context context,List<Map<String,Object>> list) {
		this.context = context;
		this.list = list;
	}
	@Override
	public int getCount() {
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder;
		if(convertView == null){
			holder = new ViewHolder();
			convertView = LayoutInflater.from(context).inflate(R.layout.item_lv_activity_detail, null);
			holder.tvTipsName = (TextView)convertView.findViewById(R.id.tvTipsName);
			holder.tvTipsValue = (TextView)convertView.findViewById(R.id.tvTipsValue);
			convertView.setTag(holder);
		}else{
			holder = (ViewHolder) convertView.getTag();
		}
		holder.tvTipsName.setText(list.get(position).get("name").toString()+"：");
		holder.tvTipsValue.setText(list.get(position).get("value").toString());
		return convertView;
	}
	
	class ViewHolder{
		/** 说明名称 */
		private TextView tvTipsName;
		/** 说明内容*/
		private TextView tvTipsValue;
	}

}
